package com.sk.weichat.adapter;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.sk.weichat.bean.Friend;

public class MyMultipleItem implements MultiItemEntity, Comparable<MyMultipleItem> {
    public static final int CALL_TYPE = 1;//打招呼消息
    public static final int RELATION_TYPE = 2;//关系消息
    public static final int NORMAL_TYPE = 3;//普通消息
    public static final int GROUP_TYPE = 4;//群通知

    public static final int WALLET_TYPE = 5;//钱包通知消息

    public void setItemType(int itemType) {
        this.itemType = itemType;
    }

    private int itemType;

    public void setData(Friend data) {
        this.data = data;
    }

    private Friend data;

    private String msg_content = "";// 消息内容
    private String msg_title = "";//消息标题
    private long time;//消息时间
    private int count;//消息未读数量

    private long topTime;

    public MyMultipleItem() {

    }


    public MyMultipleItem(int itemType) {
        this.itemType = itemType;
    }


    public MyMultipleItem(int itemType, Friend data) {
        this.itemType = itemType;
        this.data = data;
    }

    @Override
    public int getItemType() {
        return itemType;
    }

    public Friend getData() {
        return data;
    }

    public String getMsg_content() {
        return msg_content;
    }

    public void setMsg_content(String msg_content) {
        this.msg_content = msg_content;
    }

    public String getMsg_title() {
        return msg_title;
    }

    public void setMsg_title(String msg_title) {
        this.msg_title = msg_title;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public long getTopTime() {
        return topTime;
    }

    public void setTopTime(long topTime) {
        this.topTime = topTime;
    }

    @Override
    public int compareTo(MyMultipleItem item) {
        //优先置顶时间排，然后消息时间排序，降序
        if (item.getTopTime() - topTime > 0) {
            return 1;
        } else if (item.getTopTime() - topTime == 0) {
            return (int) (item.getTime() - time);
        } else {
            return -1;
        }
    }
}